package com.example.controller;

import com.example.dto.EasyUIDataGridResult;
import com.example.dto.Result;
import com.example.service.ItemParamService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * <p>商品规格参数模版管理</p>
 * Created by zhezhiyong@163.com on 2018/7/30.
 */
@Controller
@RequestMapping("/item/param")
public class ItemParamController {

    @Resource
    private ItemParamService itemParamService;

    @RequestMapping("/query/itemcatid/{cid}")
    @ResponseBody
    public Result getItemCatByCid(@PathVariable Long cid) {
        return itemParamService.getItemParamByCid(cid);
    }


    @RequestMapping("/save/{cid}")
    @ResponseBody
    public Result saveItemParam(@PathVariable Long cid, String paramData) {
        return itemParamService.saveItemParam(cid, paramData);
    }

    @RequestMapping("/list")
    @ResponseBody
    public EasyUIDataGridResult list(@RequestParam Integer page, @RequestParam Integer rows) {
        return itemParamService.getItemParamList(page, rows);
    }
}
